/* $RCSFile: ftb.imagegallery.aspx.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/AddonNice/app_support/ftb.imagegallery.aspx.cs $
 * $log$
 * Revision 20 2010/08/09 10:51:18  christian.surieux
 *   Added Log comment to all .aspx .ascx .master files
 * Revision 19 2010/08/09 09:43:42  christian.surieux
 *   Added Log to cs sources files
 * Revision 6 2010/08/06 19:56:24  christian.surieux
 *   Added Log to All cs files
 */

using System;

namespace AddonNice.Ftb
{
	public partial class Imagegallery : AddonNice.UI.EditItemPage 
	{
        protected void Page_Load(Object Src, EventArgs E)
        {
            
            string currentFolder                =   ImageGallery1.CurrentImagesFolder;

            // modify the directories allowed
            if (currentFolder == "~/images")
            {

                // these are the default directories FTB:ImageGallery will find
                string[] defaultDirectories     =   System.IO.Directory.GetDirectories(Server.MapPath(currentFolder), "*");

                // user defined custom directories
                string[] customDirectories      =    new string[] { "folder1", "folder2" };

                // the gallery will use these images in this instance
                ImageGallery1.CurrentDirectories = customDirectories;
            }


            // modify the images allowed
            if (currentFolder == "~/images")
            {

                System.IO.DirectoryInfo directoryInfo   =   new System.IO.DirectoryInfo(Server.MapPath(currentFolder));

                // these are the default images FTB:ImageGallery will find
                System.IO.FileInfo[] defaultImages      =   directoryInfo.GetFiles("*");

                // user defined custom images (here, we're just allowing the first two)
                //System.IO.FileInfo[] customImages = new System.IO.FileInfo[2] { defaultImages[0], defaultImages[1] };

                // the gallery will use these images in this instance
                //ImageGallery1.CurrentImages = customImages;
                ImageGallery1.CurrentImages             =   defaultImages;
            }
        }

	}
}
